package IO流.字节;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.Clock;
import java.time.LocalDate;
import java.util.Date;

public class 循环读取 {
    public static void main(String[] args) throws IOException {
        //1.创建文本读取的对象
        FileInputStream fis=new FileInputStream("F\\aaa\\a.txt");
        //2.循环读取
        //错误
//       while (fis.read()!=-1){
//           System.out.print((char) fis.read());
//       }
        //正确的循环书写
//        int b;
//        while ((b=fis.read())!=-1){
//            System.out.print((char) b);
//        }
       //3.释放资源
        long l = System.currentTimeMillis();
        Date date=new Date(l);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String format = sdf.format(date);
        System.out.println(format);
    }
}
